package com.qining618.common.result;

/**
 * @author flt
 * @date 2019-08-16
 */
public enum ErrorCode {

    SUCCESS(0, "成功"),
    FAILED(-1, "失败"),

    BAD_REQUEST(400, "请求错误"),
    UNAUTHORIZED(401, "未授权"),
    FORBIDDEN(403, "没有权限"),

    DATA_NOT_FOUND(404, "数据不存在"),
    DATA_CONFLICT(409, "数据已存在"),

    REMOTE_ERROR(998, "调用第三方服务失败"),
    DB_ERROR(999, "服务器繁忙"),

    /* 参数错误：10001-19999 */
    PARAM_IS_INVALID(10_001, "参数无效"),
    PARAM_IS_BLANK(10_002, "参数为空"),
    PARAM_TYPE_BIND_ERROR(10_003, "参数类型错误"),
    PARAM_NOT_COMPLETE(10_004, "参数缺失"),

    MOBILE_CONFLICT(11_0001, "手机号已存在"),

    ;

    private final int code;

    private final String message;

    ErrorCode(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public int getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }
}

